<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
        <title>权限</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">
    <script src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script src="../lib/axios.min.js"></script>
    <script src="../lib/FileSaver.min.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space10">
        <br/><br/>
        <div class="layui-col-md4">
          <form class="layui-form" id="mainForm">
            <div class="layui-form-item">
              <label for="newn" class="layui-form-label">
                用户名
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="newn" name="new"
                  autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-form-item">
              <label for="newp" class="layui-form-label">
                密码
              </label>
              <div class="layui-input-inline">
                <input type="text" id="newp" name="new"
                autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-form-item">
              <label for="newj" class="layui-form-label">
                所属角色
              </label>
              <div class="layui-input-inline">
                <div id="view1"></div>
              </div>
            </div>
            <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button type="button" class="layui-btn" lay-filter="inc" lay-submit="">
                新增
              </button>
            </div>
          </form>
        </div>
        <div class="layui-col-md8">
          <table id="t1" lay-filter="tab1" style="margin: 0 auto;" class="layui-table"></table>
        </div>
    </div>
    
    <div class="layui-row layui-col-space10">
      <br/><br/>
      <div class="layui-col-md4">
        <form class="layui-form" id="mainForm">
          <div class="layui-form-item">
            <label for="news" class="layui-form-label">
              角色名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="news" name="new"
                autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button type="button" class="layui-btn" lay-filter="inc" lay-submit="">
              新增
            </button>
          </div>
          <div class="layui-form-item">
            <label for="js" class="layui-form-label">
              角色
            </label>
            <div class="layui-input-inline">
              <div id="view2"></div>
            </div>
          </div>
          <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button type="button" class="layui-btn layui-btn-normal" lay-filter="save" lay-submit="">
              保存
            </button>
            <button type="button" class="layui-btn layui-btn-danger" lay-filter="del" lay-submit="">
                删除
            </button>
          </div>
        </form>
      </div>
      <div class="layui-col-md8">
        <table class="layui-table" lay-data="{width:800, url:'/test/table/demo2.json?v=2', page: true, limit: 6, limits:[6]}">
          <thead>
            <tr>
              <th lay-data="{checkbox:true}" rowspan="2"></th>
              <th lay-data="{field:'username', width:120}" colspan="3">档案管理</th>
              <th lay-data="{field:'amount', width:120}" colspan="3">借阅利用</th>
              <th lay-data="{field:'amount', width:120}" colspan="3">统计报表</th>
              <th lay-data="{field:'username', width:120}" colspan="2">档案配置</th>
              <th lay-data="{field:'amount', width:120}" colspan="3">系统设置</th>
            </tr>
            <tr>
              <th lay-data="{field:'province', width:50}">录入</th>
              <th lay-data="{field:'city', width:50}">管理</th>
              <th lay-data="{field:'zone', width:50}">导入</th>
              <th lay-data="{field:'province', width:50}">借阅</th>
              <th lay-data="{field:'city', width:50}">移交</th>
              <th lay-data="{field:'zone', width:50}">库房</th>
              <th lay-data="{field:'city', width:50}">报表</th>
              <th lay-data="{field:'zone', width:50}">统计</th>
              <th lay-data="{field:'province', width:50}">日志</th>
              <th lay-data="{field:'city', width:50}">类型</th>
              <th lay-data="{field:'zone', width:70}">可选项</th>
              <th lay-data="{field:'province', width:50}">节点</th>
              <th lay-data="{field:'province', width:50}">权限</th>
              <th lay-data="{field:'city', width:50}">备份</th>
            </tr>
          </thead>
        </table>
      </div>
    </div>
  </div>
  <script type="text/html" id="demo1">
    <select name="uid" lay-filter="optType">
        {{#  layui.each(users, function(index, item){ }}
        <option value="{{item.uid}}">{{item.name}}</option>
        {{#  }); }}
        {{#  if(users.length === 0){ }}
            无数据
        {{#  } }}
    </select>
  </script>
  <script type="text/html" id="demo2">
    <select name="jid" lay-filter="optType">
        {{#  layui.each(js, function(index, item){ }}
        <option value="{{item.jid}}">{{item.name}}</option>
        {{#  }); }}
        {{#  if(js.length === 0){ }}
            无数据
        {{#  } }}
    </select>
  </script>
  <script type="text/html" id="bar">
    <a lay-event="update" title="停用" href="javascript:;">
        <i class="layui-icon">&#xe642;</i></a>
    <a lay-event="moveup" title="启用" href="javascript:;">
      <i class="layui-icon">&#xe619;</i></a>
    <a lay-event="delete" title="删除" href="javascript:;">
        <i class="layui-icon">&#xe640;</i></a>
  </script>
  <script>
    var users = [{'uid':1,'name':'张三'},{'uid':2,'name':'王五'}];
    var js = [{'uid':3,'name':'管理员'},{'uid':4,'name':'录入员'}];
    layui.use(['form','table','laytpl'], function(){
      var form = layui.form
      ,table = layui.table
      ,laytpl = layui.laytpl;

      var getTpl1 = demo1.innerHTML
      ,view1 = document.getElementById('view1');
      
      laytpl(getTpl1).render(users, function(html){
          view1.innerHTML = html;
      });
      var getTpl2 = demo2.innerHTML
      ,view2 = document.getElementById('view2');
      
      laytpl(getTpl2).render(js, function(html){
          view2.innerHTML = html;
      });
      form.render('select');

      table.render({
        elem:'#t1'
        ,width: 400
        ,cols: [[
          {field: 'name', title: '用户名'}
          ,{field: 'word', title: '密码'}
          ,{field: 'title', title: '角色'}
          ,{field: '', title: '操作', toolbar: '#bar'}
        ]]
        ,data: []
      });
      table.render({
        elem:'#t2'
        ,data: []
      })
    })
  </script>
</body>
</html>